package py.com.erpone.session.dm.list;

import java.util.List;

import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import py.com.erpone.entity.dm.Sector;

/**
 * Session Bean implementation class SectorList
 */
@Stateless
@LocalBean
@Named
public class SectorList {
	
	@PersistenceContext
	private EntityManager em;
	
	
	//Recupera la lista de todos los sectores
	@SuppressWarnings("unchecked")
	public List<Sector> findAll(){ 
		List<Sector> result=(List<Sector>)em.createNamedQuery("sector.all").getResultList();
		return result;
	}
	
	//Recupera un Sector por id
	public Sector findById(Long id){
		return em.find(Sector.class, id);
	}
    
}
